import type { R, TableDataInfo } from '@/api/model/resultModel';
import type { XhljTopicForm, XhljTopicQuery, XhljTopicVo } from '@/api/xhlj/model/topicModel';
import { request } from '@/utils/request';

// 查询话题列表
export function listTopic(query?: XhljTopicQuery) {
  return request.get<TableDataInfo<XhljTopicVo>>({
    url: '/xhlj/topic/list',
    params: query,
  });
}

// 查询话题详细
export function getTopic(topicId: number) {
  return request.get<R<XhljTopicVo>>({
    url: `/xhlj/topic/${topicId}`,
  });
}

// 新增话题
export function addTopic(data: XhljTopicForm) {
  return request.post<R<void>>({
    url: '/xhlj/topic',
    data,
  });
}

// 修改话题
export function updateTopic(data: XhljTopicForm) {
  return request.put<R<void>>({
    url: '/xhlj/topic',
    data,
  });
}

// 删除话题
export function delTopic(topicIds: number | Array<number>) {
  return request.delete<R<void>>({
    url: `/xhlj/topic/${topicIds}`,
  });
}
